package WWW.SST.LIB;

/** 
 Mail ��ժҪ˵����
*/
public class Mail extends MOLE.App.Every
{
	private MailMessage mail = new MailMessage();
//		string to="";
 private String from = "ʱʱ��";
//		string subject="�����ʼ����͹���!";
//		string content="����Ա����,�����Ը�������ʼ����ж��������䷢�Ͳ�������������ȷ��"
//			+"����ע���鷢���ʼ��ͷ������Ƿ���ȷ��";

	private String uname = "";
	private String upass = "";
	private String smtpserver = "";


	public Mail()
	{
		//
		// TODO: �ڴ˴���ӹ��캯���߼�
		//
		String cmdText = "select top 1 * from SendEmail_Config where key_name='��������'";
		SqlDataReader reader = MOLE.SQL.ExecuteReader(cmdText);
		if (reader.Read())
		{
			  from = "\"ʱʱ��\"<" + reader.getItem("email").toString() + ">";
			  uname = reader.getItem("MailServerUserName").toString().trim();
			  upass = reader.getItem("MailServerPassWord").toString().trim();
			  smtpserver = reader.getItem("smtp").toString().trim();

		}

	}

	public final void Send(String ToEmail, String subject, String content)
	{


			mail.To = ToEmail;
			mail.From = this.from; // "tennogawa@163.com";
			//mail.
			mail.Subject = subject;
			mail.Body = content;
			mail.BodyFormat = MailFormat.Html;
			mail.Priority = MailPriority.High;
			//	mail.

			//mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendemailaddress","attilax@163.com");  //sender mail
			//	mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpaccountname","attilax@163.com"); //email account
			mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
			mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", this.uname); //set your username here
			mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", this.upass); //set your password here
			SmtpMail.SmtpServer = this.smtpserver; //your real server goes here
			SmtpMail.Send(mail);



	}


}